<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <!--
  
This is released under an MIT License:


Copyright (C) 2011 by Chuck McCallum

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

  -->
  <head>
    <title>
      web-sandpaper
    </title>
    <style type="text/css">
      body {
        font-family: Sans-Serif;
      }
    </style>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript">
      jQuery(function($){
        // global
        $ws_root = location.protocol + (location.protocol == "file:" ? "" : "//" ) +
          location.host + location.pathname.replace(/\/[^/]*$/,"/");
        var bookmark_uri = $ws_root + "js/selectorgadget.js"
        var js_source = 
         "var d=document.createElement('div');\
          d.setAttribute('class','ws_loading');\
          d.innerHTML='Please wait.';\
          d.style.color='black';\
          d.style.padding='1em';\
          d.style.position='fixed';\
          d.style.zIndex='9999';\
          d.style.border='2px solid black';\
          d.style.left='40px';\
          d.style.top='40px';\
          d.style.background='white';\
          document.body.appendChild(d);\
          var s=document.createElement('script');\
          s.setAttribute('type','text/javascript');\
          s.setAttribute('src','"+bookmark_uri+"');\
          document.body.appendChild(s);"
        js_uri = "javascript:(function(){"
          + encodeURIComponent(js_source.replace(/;\s+/g,";").replace(/\s+/," "))
          + "})()";
        $("#bookmark").attr("href",js_uri);
      })
    </script>
  </head>
  <body>
    <p>
Web-sandpaper will be a bookmarklet that generates bookmarklets: By itself, it 
identifies the xpaths and regexes than can pull the data you need out of the page. You 
could use these code bits in your own scraper, or, for smaller jobs, you can use the 
generated bookmarklet to apply the same patterns to similar pages.
    </p>
    <p>But for the moment, <a href="#" id="bookmark">this is a placeholder</a>.</p>
    <hr/>
    <p>Here are some page fragments to practice on:</p>
    <table>
      <tr><td>A1</td><td>B1</td><td>C1</td></tr>
      <tr><td>A2</td><td>B2</td><td>C2</td></tr>
      <tr><td>A3</td><td>B3</td><td>C3</td></tr>
    </table>
    <hr/>
    <p>Here are the <a href="test/test.html">tests</a></p>
  </body>
</html>
